import {defineConfig} from 'vite';
import vue from '@vitejs/plugin-vue';
import {link} from "./src/config/config.js";
import path from 'path'

export default ({mode}) => {
    return defineConfig({
        plugins: [vue()],
        base: link,
        resolve: {
            alias: [
                {
                    find: '@',
                    replacement: path.resolve(__dirname, 'src')
                },
            ]
        },
        server: {
            https: false,
            host: '0.0.0.0',
            port:1234,
            proxy: {
                '/target_station': {
                    target: 'http://192.168.0.154',
                    changeOrigin: true, // 允许跨域
                    rewrite: (path) => path.replace(/^\/target_station/, '/target_station'), // 重新写路径
                },
            },
        },

    });
}
